import {
  createSlice,
} from "@reduxjs/toolkit";
import { IFlatMenuType } from "@/utils/menuUitls";
import { RouteObject } from "react-router-dom";


/**
 * 菜单
 */
export const menuSlice = createSlice({
  name: "menu",
  initialState: {
    menus: <IFlatMenuType[]>[],
    routes:<RouteObject[]>[]
  },
  reducers: {
    setMenuList(state, action) {
      state.menus = action.payload;
    },
    setRoutes(state, action) {
      state.routes = action.payload;
    },
  },

});
export const { setMenuList ,setRoutes} = menuSlice.actions
export default menuSlice.reducer;